package com.example.demo.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;

@Getter
@Setter
@NoArgsConstructor//为类自动生成一个无参构造函数
public class Stu2 {
    //校验规则使用注释
    private Long id;
    @NotBlank
    @Size(min=2,max=6,message = "{name.size.error}")
    private String name;
    @DecimalMin(value="12",inclusive = true)//>=12
    private double java;
    @DecimalMax("100")
    double math;
    @Min(value=18,message="{age.outof.range}")
    int age;
    @Valid
    Address address;

    public Stu2(String name, double java, double math) {
        this.name = name;
        this.java = java;
        this.math = math;
    }
}
